<template>
	<view class="">
		<!-- 头部 -->
		<view class="header">
			<view class="userInfo" @click="goSet">
				<image mode="widthFix" @tap="preview_event" @error="user_avatar_error" :src="user_avatar || avatar">
				</image>
				<view class="userInfo-info">
					<view class="">{{nickname}}</view>
					<view class="phone">{{user.phone}}</view>
				</view>
			</view>
		</view>
		<view class="" v-if="admin_token != ''">
			<!-- 客户消息 -->
			<!-- <view class="client_info">
				<view class="client_item">
					<view class="client_num">102</view>
					<view class="client_name">客户总数</view>
				</view>
				<view class="client_item">
					<view class="client_num">1020</view>
					<view class="client_name">订单金额</view>
				</view>
				<view class="client_item">
					<view class="client_num">100</view>
					<view class="client_name">订单数</view>
				</view>
			</view> -->
			<!-- 常用功能 -->
			<view class="mybackend">
				<view class="mybackend-title">常用功能</view>
				<view class="mybackend-item">
					<view class="item" @click="OnOrder">
						<image src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/11/8c6cb67a4a9f4467aa8d6683de78e1c2.png" class="item-icon" mode="widthFix"></image>
						<view class="">{{anavigation[0].name}}</view>
					</view>
					<view class="item" @click="clear_cache_envent">
						<image
							src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/dcd8fdf4d8cc44b5a94d3e594dc1c3d4.png"
							mode="widthFix"></image>
						<view class="">清缓存</view>
					</view>
					<view class="item" @click="onmodify()">
						<image
							src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/9edd799604a147f6b526082a6d70200c.png"
							mode="widthFix"></image>
						<view class="">修改名片</view>
					</view>
				</view>
			</view>
			<!-- 上货平台 -->
			<view class="product" v-if="((anavigation || null) !=null && anavigation.length>2)">
				<view class="product-title">上货平台</view>
				<view class="product-item">
					<view class="item" @click="pricing_gold()">
						<image :src="c_static_urls + anavigation[2].images_url" class="item-icon" mode="widthFix">
						</image>
						<view class="anavigation_name">{{anavigation[2].name}}</view>
					</view>
					<view class="item" @click="valuation_gold()">
						<image :src="c_static_urls + anavigation[3].images_url" class="item-icon" mode="widthFix">
						</image>
						<view class="anavigation_name">{{anavigation[3].name}}</view>
					</view>
					<view class="item" @click="pricing_diamond()">
						<image :src="c_static_urls + anavigation[4].images_url" class="item-icon" mode="widthFix">
						</image>
						<view class="anavigation_name">{{anavigation[4].name}}</view>
					</view>
					<view class="item" @click="valuation_diamond()">
						<image :src="c_static_urls + anavigation[5].images_url" class="item-icon" mode="widthFix">
						</image>
						<view class="anavigation_name">{{anavigation[5].name}}</view>
					</view>
					<view class="item" @click="empty_stock()">
						<image
							src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/1fee8225832943bdb20b104bd035053a.png"
							mode="widthFix"></image>
						<view class="">版房空托</view>
						<view class="">商品上新</view>
					</view>
					<view class="item" @click="drinks()">
						<image
							src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/3a3a1d38f06f426f993e80a23735a8b1.png"
							mode="widthFix"></image>
						<view class="">礼品类</view>
						<view class="">商品上新</view>
					</view>
				</view>
			</view>
			<!-- 扫码核销 -->
			<view class="product_off_footer">
				<view class="product_off">
					<view class="product_off_title">扫码核销</view>
					<view class="product_off_item">
						<view class="item" @click="Ongold_scan_cancel">
							<image src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/290649779bc448f1a5cbc6836a945324.png" mode="widthFix"></image>
							<view class="">商品扫</view>
							<view class="">码核销</view>
						</view>
						<view class="item" @click="Ondiamond_scan_cancel">
							<image src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/4a75d03137aa40a1b6e5f2d0d50f1220.png" mode="widthFix"></image>
							<view class="">钻石扫</view>
							<view class="">码核销</view>
						</view>
						<view class="item" @click="Oncoupon_cancel">
							<image src="https://t1.chowtaiking.com.cn/img/ruoyi/2025/03/10/f1d12385bf0b49728f83774cfc35bb44.png" mode="widthFix"></image>
							<view class="">优惠劵</view>
							<view class="">核销码</view>
						</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const app = getApp();
	
	export default{
		props:['admin_token','anavigation','c_static_urls','user','user_avatar','nickname'],
		data(){
			return{
				
				
			}
		},
		methods:{
			// 跳转名片
			goScan(){
				this.$emit('goScan')
			},
			// 头像查看
			preview_event(){
				this.$emit('preview_event')
			},
			// 头像加载错误
			user_avatar_error(){
				this.$emit('user_avatar_error')
			},
			// 跳到修改个人信息页面
			goSet() {
				uni.navigateTo({
					url: "/pages/user_setInfo/setInfo"
				})
			},
			// 我的订单
			OnOrder() {
				uni.navigateTo({
					url: "/pages/user-order/user-order?gl=0"
				})
			},
			// 黄金产品核销
			Ongold_scan_cancel(){
				uni.navigateTo({
					url:"/pages/manage/update_stu/gold_scan_cancel/gold_scan_cancel"
				})
			},
			// 钻石产品核销
			Ondiamond_scan_cancel(){
				uni.showToast({
					title:"还在更新中...",
					icon:'error'
				})
			},
			// 优惠劵核销
			Oncoupon_cancel(){
				uni.showToast({
					title:"还在更新中...",
					icon:'error'
				})
			},
			// 清除缓存
			clear_cache_envent(){
				this.$emit('clear_cache_envent')
			},
			// 跳转修改名片
			onmodify() {
				uni.navigateTo({
					url: "/pages/card_modify/card_modify"
				})
			},
			// 黄金定价页面
			pricing_gold() {
				uni.navigateTo({
					url: "/pages/manage/product/pricing_gold"
				})
			},
			// 黄金计价页面
			valuation_gold() {
				uni.navigateTo({
					url: "/pages/manage/product/valuation_gold"
				})
			},
			// 钻石定价页面
			pricing_diamond() {
				uni.navigateTo({
					url: "/pages/manage/diamond/pricing_diamond"
				})
			},
			// 钻石计价页面
			valuation_diamond() {
				uni.navigateTo({
					url: "/pages/manage/diamond/valuation_diamond"
				})
			},
			// 空托上货
			empty_stock(){
				uni.navigateTo({
					url:"/pages/manage/empty/empty_diamond"
				})
			},
			// 酒水上货
			drinks(){
				uni.navigateTo({
					url:"/pages/manage/drinks/drinks"
				})
			}
		}
	}
</script>

<style lang="less">
	/* 头部 */
	.header {
		display: flex;
		align-items: center;
		justify-content: space-around;
		background-color: #f7dcad;

		.userInfo {
			width: 100%;
			display: flex;
			padding-left: 30px;
			padding-top: 20px;

			image {
				width: 40px;
				height: 40px;
				border-radius: 50%;
			}

			.userInfo-info {
				margin-left: 10px;
				padding-bottom: 20px;

				.wrz {
					font-size: 12px;
				}

				.phone {
					color: #b7a68c;
				}
			}
		}

		.sm_logo {
			image {
				padding-right: 20px;
				width: 25px;
			}
		}

		.sm_logo_name {
			font-size: 8px;
		}
	}

	// 客户消息
	.client_info {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding: 20rpx;
		background-color: white;

		.client_item {
			display: flex;
			flex-direction: column;
			align-items: center;
			justify-content: center;

			.client_num {
				font-weight: bold;
				font-size: 15px;
			}

			.client_name {
				font-size: 13px;
				color: gray;
			}
		}
	}

	// 我的后台
	.mybackend {
		background-color: white;
		margin-top: 10px;
		padding-bottom: 20px;
	}

	.mybackend-title {
		padding-left: 20px;
		padding-top: 20px;
	}

	.mybackend-item {
		display: flex;
		align-items: center;
		flex-wrap: wrap;
	}

	.mybackend-item .item {
		width: 25%;
		display: flex;
		align-items: center;
		justify-content: center;
		flex-direction: column;
		margin-top: 25px;
		font-size: 12px;
		color: gray;
	}

	.mybackend-item .item image {
		width: 25px;
		height: 25px;
	}

	/* 产品管理 */
	.product {
		background-color: white;
		margin-top: 10px;
		padding-bottom: 20px;
	}

	.product-title {
		padding-left: 20px;
		padding-top: 20px;
	}

	.product-item {
		display: flex;
		align-items: center;
		justify-content: space-between;
		padding-left: 15px;
		padding-right: 15px;
		padding-top: 20px;
	}

	.product-item .item {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
		font-size: 10px;
	}

	.product-item .item image {
		width: 25px;
		height: 25px;
		padding-bottom: 5px;
	}

	.anavigation_name {
		width: 90rpx;
	}
	
	// 产品核销
	.product_off_footer{
		padding-bottom: 260rpx;
		.product_off{
			background-color: white;
			margin-top: 10px;
			padding-bottom: 20px;
			.product_off_title{
				padding-left: 20px;
				padding-top: 20px;
			}
			.product_off_item{
				display: flex;
				align-items: center;
				justify-content: space-between;
				padding-right: 20rpx;
				padding-top: 20px;
				font-size: 10px;
				.item{
					display: flex;
					flex-direction: column;
					align-items: center;
					justify-content: center;
					font-size: 10px;
					padding-left: 40rpx;
					image{
						width: 25px;
						height: 25px;
						padding-bottom: 5px;
					}
				}
			}
		}
	}
	
</style>